package cn.edu.lingnan.servlet;

import java.io.IOException;

import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import cn.edu.lingnan.dao.ActDAO;
import cn.edu.lingnan.dto.Act;

public class InsertActServlet extends HttpServlet {
	protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
		String acid=req.getParameter("acid");
		String oid=req.getParameter("oid");
		String acname=req.getParameter("acname");
		String acintroduction=req.getParameter("acintroduction");
		Act a=new Act();
		a.setacId(acid);
		a.setoId(oid);
		a.setacName(acname);
		a.setacIntroduction(acintroduction);
		ActDAO ad=new ActDAO();
		int flag=ad.insertInfoToAct(a);
		System.out.println(flag);
		if(flag==1)
			resp.sendRedirect(req.getContextPath()+"/admin/admin.html");
		else
			resp.sendRedirect(req.getContextPath()+"/error.html");
	}
}
